Add --destdir option to install.sh
authorFlorian Hahn <flo@fhahn.com>
Tue, 15 Jul 2014 07:34:47 +0000 (09:34 +0200)
committerFlorian Hahn <flo@fhahn.com>
Tue, 15 Jul 2014 14:25:44 +0000 (16:25 +0200)
Makefile
src/install.sh

index 1394aa268904c991d0840368cb878c6ffd236343..b638664e4dcd479a8b6bdd7981e188e7c8ec8614 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -135,7 +135,7 @@ $(PKGDIR)/lib/cargo/manifest.in: $(BIN_TARGETS) Makefile
        mv $(DISTDIR)/manifest-$(PKG_NAME).in $(PKGDIR)/lib/cargo/manifest.in
 
 install: $(PKGDIR)/lib/cargo/manifest.in
-       $(PKGDIR)/install.sh --prefix=$(PREFIX)
+       $(PKGDIR)/install.sh --prefix=$(PREFIX) --destdir=$(DESTDIR)
 
 # Setup phony tasks
 .PHONY: all clean distclean test test-unit test-integration libcargo style
index 89b6e211756f1a720de0a277631f9958a7e76afd..206adfb27ff6c31c8be2842d76de9d6aa73a4cf0 100755 (executable)
@@ -278,12 +278,14 @@ VAL_OPTIONS=""
 CFG_LIBDIR_RELATIVE=lib
 
 flag uninstall "only uninstall from the installation prefix"
+valopt destdir "" "set installation root"
 opt verify 1 "verify that the installed binaries run correctly"
 valopt prefix "/usr/local" "set installation prefix"
 # NB This isn't quite the same definition as in `configure`.
 # just using 'lib' instead of CFG_LIBDIR_RELATIVE
-valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
-valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
+valopt libdir "${CFG_DESTDIR}${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
+valopt mandir "${CFG_DESTDIR}${CFG_PREFIX}/share/man" "install man pages in PATH"
+
 
 if [ $HELP -eq 1 ]
 then
@@ -402,7 +404,7 @@ need_ok "failed to create installed manifest"
 while read p; do
 
     # Decide the destination of the file
-    FILE_INSTALL_PATH="${CFG_PREFIX}/$p"
+    FILE_INSTALL_PATH="${CFG_DESTDIR}${CFG_PREFIX}/$p"
 
     if echo "$p" | grep "^lib/" > /dev/null
     then
@@ -446,7 +448,7 @@ done < "${CFG_SRC_DIR}/${CFG_LIBDIR_RELATIVE}/cargo/manifest.in"
 if [ -z "${CFG_DISABLE_VERIFY}" ]
 then
     msg "verifying installed binaries are executable"
-    "${CFG_PREFIX}/bin/cargo" -h > /dev/null
+    "${CFG_DESTDIR}${CFG_PREFIX}/bin/cargo" -h > /dev/null
     if [ $? -ne 0 ]
     then
         ERR="can't execute installed rustc binary. "